/*
 * @Author: szx
 * @Date: 2023-04-17 15:30:36
 * @LastEditTime: 2023-04-17 15:37:49
 * @Description:
 * @FilePath: \learn\fullstackopen\part6\redux-anecdotes-main\src\components\Filter.jsx
 */
import { useDispatch } from 'react-redux';

import { setFilter } from '../reducers/filterReducer';
const Filter = () => {
    const dispatch = useDispatch();
    const handleChange = (event) => {
        event.preventDefault();
        dispatch(setFilter(event.target.value));
    };
    const style = {
        marginBottom: 10
    };

    return (
        <div style={style}>
            filter <input onChange={handleChange} />
        </div>
    );
};

export default Filter;
